# _*_ coding: utf8
import queue
import time
import threading
from datetime import *
from time import sleep

THREAD_NUM = 10        # 线程数
ONE_WORKER_NUM = 10    # 单个线程循环次数
J = 0                  # 总执行次数
def test():
    sleep(5)
    print(datetime.now())
    global J
    J += 1
    print(J)

def working():
    global ONE_WORKER_NUM
    for i in range(0, ONE_WORKER_NUM):
        test()

def t():
    global THREAD_NUM
    Threads = []
    for i in range(THREAD_NUM):
        t = threading.Thread(target= working, name= "T" + str(i))
        t.setDaemon(True)
        Threads.append(t)
    for t in Threads:
        t.start()
    for t in Threads:
        t.join()

if __name__ == "__main__":
    t()
    print("end")